package com.cheng.controller;


import com.cheng.entity.User;
import com.cheng.reponse.Result;
import com.cheng.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author WuJiaHui
 * @since 2022-02-16
 */
@Api(tags = "首页模板")
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @ApiOperation(value = "查询用户",notes = "查询所有的用户信息")
    @GetMapping("/getUsers")
    public Result getUsers(){
        List<User> users = userService.list();
        return Result.ok().data("users",users);
    }
}

